package com.sunyard.domee.dubbo.convert;

import com.google.common.collect.Lists;
import com.sunyard.domee.response.MarketingCouponResponse;
import com.sunyard.domee.service.bo.MarketingCouponBO;
import org.apache.commons.collections.CollectionUtils;

import java.util.Collections;
import java.util.List;

/**
 * 优惠券
 *
 * @author xw
 * @email wei.xiao hiperasiachile çæææ
 * @date 2020-05-26 20:48:42
 */
public class MarketingCouponConvert {

    public static MarketingCouponResponse toResponse(MarketingCouponBO washCarServiceBO) {
        if (washCarServiceBO == null) {
            return null;
        }
        MarketingCouponResponse marketingCouponResponse = new MarketingCouponResponse();
        marketingCouponResponse.setId(washCarServiceBO.getId());
        marketingCouponResponse.setCouponName(washCarServiceBO.getCouponName());
        marketingCouponResponse.setCouponType(washCarServiceBO.getCouponType());
        marketingCouponResponse.setDiscountMax(washCarServiceBO.getDiscountMax());
        marketingCouponResponse.setAmountFullMax(washCarServiceBO.getAmountFullMax());
        marketingCouponResponse.setDiscount(washCarServiceBO.getDiscount());
        marketingCouponResponse.setLimitNum(washCarServiceBO.getLimitNum());
        marketingCouponResponse.setEffectiveDate(washCarServiceBO.getEffectiveDate());
        marketingCouponResponse.setEffectiveStartDate(washCarServiceBO.getEffectiveStartDate());
        marketingCouponResponse.setEffectiveEndDate(washCarServiceBO.getEffectiveEndDate());
        marketingCouponResponse.setCouponStatus(washCarServiceBO.getCouponStatus());
        marketingCouponResponse.setCreaterCode(washCarServiceBO.getCreaterCode());
        marketingCouponResponse.setUpdateTime(washCarServiceBO.getUpdateTime());
        marketingCouponResponse.setCreateTime(washCarServiceBO.getCreateTime());
        marketingCouponResponse.setUpdateCode(washCarServiceBO.getUpdateCode());
        marketingCouponResponse.setDelFlag(washCarServiceBO.getDelFlag());
        return marketingCouponResponse;
    }


    public static List<MarketingCouponResponse> toResponseList(List<MarketingCouponBO> doList) {
        if (CollectionUtils.isEmpty(doList)) {
            return Collections.emptyList();
        }
        List<MarketingCouponResponse> boList = Lists.newArrayList();
        for (MarketingCouponBO washCarServiceDO : doList) {
            if (washCarServiceDO != null) {
                boList.add(toResponse(washCarServiceDO));
            }
        }
        return boList;
    }


}
